package main;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

@SuppressWarnings("serial")
public class JFMain extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JFMain frame = new JFMain();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JFMain() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);

		JButton btnAbrir = new JButton("Abrir");
		btnAbrir.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				JFileChooser abrir = new JFileChooser();
				int retorno = abrir.showOpenDialog(null);
				if (retorno == JFileChooser.APPROVE_OPTION) {
					String caminho = abrir.getSelectedFile().getAbsolutePath();
					JOptionPane.showMessageDialog(null, caminho);
				}
			}
		});
		contentPane.add(btnAbrir);
		//MP3
		/*
		try{  
            java.io.InputStream in = (java.io.InputStream)(new java.io.FileInputStream("c:\a.mp3"));  
            javazoom.jl.player.Player p = new javazoom.jl.player.Player(in);  
              
            p.play();  
        }catch(Exception e){e.printStackTrace();}
        */
		//PDF
		/*
		 * Runtime.getRuntime().exec(//aki vc digita o codigo que voce usaria no prompot); 
		*/
	}
}
